package com.woniuxy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniuxy.entity.Building;
import com.woniuxy.entity.Housing;
import com.woniuxy.mapper.BuildingMapper;
import com.woniuxy.service.BuildingService;
import com.woniuxy.util.PageData;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class BuildingServiceImpl implements BuildingService {

    @Resource
    private BuildingMapper buildingMapper;

    @Override
    public List<Building> queryBuilding() {
        return buildingMapper.queryBuilding();
    }

    @Override
    public PageInfo<Building> queryBuildingByNum(PageData<Building> pageData) {
        //开始分页PageNum当前页数     PageSize每页的个数
        PageHelper.startPage(pageData.getPageNum(), pageData.getPageSize());
        List<Building> buildings = buildingMapper.queryBuildingByNum(pageData.getParam());
        PageInfo pageInfo = new PageInfo(buildings);
        return pageInfo;
    }

    @Override
    public void addBuild(Building building) {
        buildingMapper.addBuild(building);
    }

    @Override
    public void batchDelBuild(List<Integer> ids) {
        buildingMapper.batchDelBuild(ids);
    }

    @Override
    public Building selectBulidById(Integer id) {
        return buildingMapper.selectBulidById(id);
    }

    @Override
    public void saveupdateBuild(Building building) {
        buildingMapper.saveupdateBuild(building);
    }

    @Override
    public void saveDelBuild(Integer id) {
        buildingMapper.saveDelBuild(id);
    }


}
